﻿<UserControl x:Class="Chambills.PopupBehaviour.Sample.DisableBackgroundSample"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:e="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:Dialogs="clr-namespace:Chambills.PopUpBehavior;assembly=Chambills.PopUpBehavior" xmlns:Sample="clr-namespace:Chambills.PopupBehaviour.Sample" xmlns:sys="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
  <UserControl.Resources>
    <ObjectDataProvider MethodName="GetType"
      ObjectType="{x:Type sys:Type}" x:Key="colorsTypeOdp">
      <ObjectDataProvider.MethodParameters>
        <sys:String>
          System.Windows.Media.Brushes, PresentationCore,
          Version=3.0.0.0, Culture=neutral,
          PublicKeyToken=31bf3856ad364e35
        </sys:String>
      </ObjectDataProvider.MethodParameters>
    </ObjectDataProvider>
    <ObjectDataProvider ObjectInstance="{StaticResource colorsTypeOdp}"
        MethodName="GetProperties" x:Key="colorPropertiesOdp">
    </ObjectDataProvider>

  </UserControl.Resources>
  
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="20"/>
      <RowDefinition />
    </Grid.RowDefinitions>

    <StackPanel Orientation="Horizontal">
    <CheckBox Grid.Row="0" x:Name="Go" Content="Disable/Enable Background"  />
      <ComboBox Name="Colors"
    ItemsSource="{Binding Source={StaticResource colorPropertiesOdp}}"
                SelectedValue="Transparent"
    DisplayMemberPath="Name"
    SelectedValuePath="Name" />
      <TextBlock Text="Opacity"/>
      <TextBox Name="Opacity" Text="0.4"/>
    </StackPanel>
    
    <Grid Grid.Row="1">     
      <Grid.RowDefinitions>
        <RowDefinition></RowDefinition>
        <RowDefinition></RowDefinition>
        <RowDefinition></RowDefinition>
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
      </Grid.ColumnDefinitions>
      <e:Interaction.Behaviors>
        <Dialogs:DisableBackGroundBehaviour Background="{Binding ElementName=Colors, Path=SelectedValue}" 
                                            Enabled="{Binding ElementName=Go, Path=IsChecked}"
                                            Opacity="{Binding ElementName=Opacity, Path=Text}"/>
      </e:Interaction.Behaviors>
      
      <TextBox Grid.Row="0" Grid.Column="0" Text="[0,0]" Width="50"/>
      <TextBox Grid.Row="0" Grid.Column="1" Text="[0,1]" Width="50"/>
      <TextBox Grid.Row="1" Grid.Column="0" Text="[1,0]" Width="50"/>
      <TextBox Grid.Row="1" Grid.Column="1" Text="[1,1]" Width="50"/>
      <TextBlock Grid.Row="2" Grid.ColumnSpan="2" Text="The background controls are not accessible whilst the background is disabled"/>


    </Grid>

  </Grid>
</UserControl>
